package com.bstek.uflo.form.command;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.hibernate.transform.ResultTransformer;

@SuppressWarnings("serial")
public class MapResultTransformer implements ResultTransformer{
	@SuppressWarnings("rawtypes")
	public List transformList(List collection) {
		return collection;
	}
	public Object transformTuple(Object[] values, String[] columns) {
		Map<String, Object> map = new LinkedHashMap<String, Object>();
		int i = 0;
		for (String column : columns) {
			map.put(column.toLowerCase(), values[i++]);
		}
		return map;
	}
}
